package study.javabasic.communication.WhileCom;

import com.sun.org.apache.xpath.internal.SourceTree;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * Created by zhangshuhan on 2019/3/20.
 */
public class ThreadB implements Runnable {

     List<String> list;


    public ThreadB( List<String> list) {
        super();
        this.list = list;
    }


    @Override
    public void run() {
        System.out.println("线程2启动");
        while (true) {
         try {
               Thread.sleep(300);
          } catch (InterruptedException e) {
               e.printStackTrace();
           }
          System.out.println("线程2"+list.size());
            if (list.size() ==5) {
                System.out.println("执行线程2业务");
                break;
            }
        }

    }
}
